package com.gzhryc.shared_device.oem.code.user.dao.db;

import com.gzhryc.common.config.DefaultEnum;
import com.gzhryc.jdbc.annotaion.*;
import com.gzhryc.shared_device.base.models.IUser;

import java.util.Date;

@Table(name="user_info")
public class User implements IUser {

    @Id(autoIncrement = 1000)
    @Column
    protected Long id;

    @Column(notNull = true,length = 32,note = "昵称")
    protected String nickname;

    @Column(length = 32,note = "真实姓名")
    protected String name;

    @UniqueKey
    @Column(length = 16,note = "手机号")
    protected String phone;

    @Column(name = "app_id",note = "微信应用ID")
    protected String appId;

    @Column(name = "open_id",note = "微信OpenID")
    protected String openId;

    @Column(name = "face_img",length = 255,note = "头像")
    protected String faceImg;

    @Column(notNull = true,defVal = "1",note = "性别")
    protected Integer sex;

    @Column(name="login_pwd",note = "登陆密码")
    protected String loginPwd;
    
    @Column(name="login_token",note = "登陆Token")
    protected String loginToken;

    @Column(name="last_login_type",note = "最后登录类型")
    protected String lastLoginType;

    @Column(name="last_login_date",note = "最后登录时间")
    protected Date lastLoginDate;

    @Column
    protected Date birthday; // 出生日期

    @Column(name = "identity_card_id")
    protected String identityCardId; // 身份证号

    @Column(name="referrer_id",note = "推荐人ID")
    protected Long referrerId;

    @Column(name="referrer_name",length = 64,note = "推荐人姓名")
    protected String referrerName;

    @Column(name = "update_date", autoUpdateTime = true)
    protected Date updateDate;

    @Column(name = "create_date")
    protected Date createDate;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public String getOpenId() {
        return openId;
    }

    public void setOpenId(String openId) {
        this.openId = openId;
    }

    public String getFaceImg() {
        return faceImg;
    }

    public void setFaceImg(String faceImg) {
        this.faceImg = faceImg;
    }

    public Integer getSex() {
        return sex;
    }

    public void setSex(Integer sex) {
        this.sex = sex;
    }
    
    public String getLoginPwd() {
        return loginPwd;
    }

    public void setLoginPwd(String loginPwd) {
        this.loginPwd = loginPwd;
    }
    
    public String getLoginToken() {
		return loginToken;
	}

	public void setLoginToken(String loginToken) {
		this.loginToken = loginToken;
	}

	public String getLastLoginType() {
        return lastLoginType;
    }

    public void setLastLoginType(String lastLoginType) {
        this.lastLoginType = lastLoginType;
    }

    public Date getLastLoginDate() {
        return lastLoginDate;
    }

    public void setLastLoginDate(Date lastLoginDate) {
        this.lastLoginDate = lastLoginDate;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    public String getIdentityCardId() {
        return identityCardId;
    }

    public void setIdentityCardId(String identityCardId) {
        this.identityCardId = identityCardId;
    }

    public Long getReferrerId() {
        return referrerId;
    }

    public void setReferrerId(Long referrerId) {
        this.referrerId = referrerId;
    }

    public String getReferrerName() {
        return referrerName;
    }

    public void setReferrerName(String referrerName) {
        this.referrerName = referrerName;
    }

    public Date getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public String getSexName(){
        return DefaultEnum.Sex.note(this.sex);
    }

    public String getFullName() {
        return this.name + "(" + this.phone + ")";
    }

}
